Skip to content

GroupBox

Sub classes

Name Children Inherits
OptionalWidget
prettyqt.custom_widgets.optionalwidget
Wraps another widget in a GroupBox with and CheckBock and makes it optional.
    FlagSelectionWidget
    prettyqt.custom_widgets.editors.flagselectionwidget
      StringOrNumberWidget
      prettyqt.custom_widgets.editors.stringornumberwidget
        SelectionWidget
        prettyqt.custom_widgets.editors.selectionwidget
          ModelEditor
          prettyqt.custom_widgets.pydanticform
          Group box holding a sub-form for a nested model field.

            Base classes

            Name Children Inherits
            WidgetMixin
            prettyqt.widgets.widget
            QGroupBox
            PySide6.QtWidgets
            QGroupBox(self, title: str, /, parent: PySide6.QtWidgets.QWidget | None \= None, *, alignment: PySide6.QtCore.Qt.AlignmentFlag | None \= None, flat: bool | None \= None, checkable: bool | None \= None, checked: bool | None \= None) -> None

            ⋔ Inheritance diagram

            graph TD
              595380733["widgets.GroupBox"]
              829357528["widgets.WidgetMixin"]
              3227531497["core.ObjectMixin"]
              2751680898["builtins.object"]
              625385617["gui.PaintDeviceMixin"]
              2026038775["QtWidgets.QGroupBox"]
              3620195106["QtWidgets.QWidget"]
              3984060476["QtCore.QObject"]
              37984305["Shiboken.Object"]
              673956333["QtGui.QPaintDevice"]
              829357528 --> 595380733
              3227531497 --> 829357528
              2751680898 --> 3227531497
              625385617 --> 829357528
              2751680898 --> 625385617
              2751680898 --> 829357528
              2026038775 --> 595380733
              3620195106 --> 2026038775
              3984060476 --> 3620195106
              37984305 --> 3984060476
              2751680898 --> 37984305
              673956333 --> 3620195106
              37984305 --> 673956333

            🛈 DocStrings

            Bases: WidgetMixin, QGroupBox

            Group box frame with a title.

            A group box provides a frame, a title on top, a keyboard shortcut, and displays various other widgets inside itself. The keyboard shortcut moves keyboard focus to one of the group box's child widgets.

            Source code in prettyqt/widgets/groupbox.py
            class GroupBox(widgets.WidgetMixin, widgets.QGroupBox):
                """Group box frame with a title.
            
                A group box provides a frame, a title on top, a keyboard shortcut,
                and displays various other widgets inside itself.
                The keyboard shortcut moves keyboard focus to one of the group box's child widgets.
                """
            
                def __repr__(self):
                    return get_repr(self, self.title())
            
                def set_title(self, title: str):
                    self.setTitle(title)
            
                def set_alignment(
                    self, alignment: constants.HorizontalAlignmentStr | constants.AlignmentFlag
                ):
                    """Set the title alignment of the groupbox.
            
                    Args:
                        alignment: title alignment for the groupbox
                    """
                    self.setAlignment(constants.H_ALIGNMENT.get_enum_value(alignment))
            
                def get_alignment(self) -> constants.HorizontalAlignmentStr:
                    """Return current title alignment.
            
                    Returns:
                        title alignment
                    """
                    return constants.H_ALIGNMENT.inverse[self.alignment()]
            
                def set_enabled(self, state):
                    if (layout := self.layout()) is None:
                        return
                    for i in range(layout.count()):
                        if (item := layout.itemAt(i)) is not None and (
                            w := item.widget()
                        ) is not None:
                            w.setEnabled(state)
            

            get_alignment() -> constants.HorizontalAlignmentStr

            Return current title alignment.

            Source code in prettyqt/widgets/groupbox.py
            def get_alignment(self) -> constants.HorizontalAlignmentStr:
                """Return current title alignment.
            
                Returns:
                    title alignment
                """
                return constants.H_ALIGNMENT.inverse[self.alignment()]
            

            set_alignment(alignment: constants.HorizontalAlignmentStr | constants.AlignmentFlag)

            Set the title alignment of the groupbox.

            Parameters:

            Name Type Description Default
            alignment HorizontalAlignmentStr | AlignmentFlag

            title alignment for the groupbox

            required
            Source code in prettyqt/widgets/groupbox.py
            def set_alignment(
                self, alignment: constants.HorizontalAlignmentStr | constants.AlignmentFlag
            ):
                """Set the title alignment of the groupbox.
            
                Args:
                    alignment: title alignment for the groupbox
                """
                self.setAlignment(constants.H_ALIGNMENT.get_enum_value(alignment))
            

            :fa-brands-github: Show source on GitHub